<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./layui/css/layui.css">
    <script src="./layui/layui.js"></script>
    <script src="./jquery/jquery.js"></script>
    <script src="./js/template-web.js"></script>
   
</head>
<body>

    <div class="layui-container">
        <table class="layui-table">
            <thead>
                <tr>
                    <th>温度</th>
                    <th>天气</th>
                    <th>风向</th>
                    <th>更新时间</th>
                   
                </tr>
            </thead>
    
            <tbody>
    
            </tbody>
        </table>
    
    </div>
    <script id="demo" type="text/html">
        {{ each forecast_1h value index}}
            <tr>
                <td>{{ value.degree }}</td>
                <td>{{ value.weather }}</td>
                <td>{{ value.wind_direction }}</td>
                <td>{{ value.update_time }}</td>
            </tr>
           
        {{/each}}
        
    </script>
    <script>
        /*    
            https://wis.qq.com/weather/common?
                source=pc
                weather_type=observe|forecast_1h|forecast_24h|index|alarm|limit|tips|rise
                province=江苏省
                city=南京市
                county=
                callback=jQuery11130675985198442655_1667288467887
                _=1667288467889 
           
        */
        $.ajax({
            url:"https://wis.qq.com/weather/common",
            dataType:"jsonp",
            data:{
                source:"pc",
                weather_type:"forecast_1h",
                province:"江苏省",
                city:"南京市"
            },
            success:function(data){
                let result=data.data;
                console.log(result);
                let str=template("demo",result);
                $("tbody").html(str);
            }
        });
           
           
           
   
   
       </script>
</body>
</html>